const RANDOM_IMAGE =
  'image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==';

module.exports = {
  up: (queryInterface, Sequelize) =>
    queryInterface.bulkInsert(
      't_device_feature',
      [
        {
          id: 'ca91dfdf-55b2-4cf8-a58b-99c0fbf6f5e4',
          name: 'Test device feature',
          selector: 'test-device-feature',
          external_id: 'hue:binary:1',
          category: 'light',
          type: 'binary',
          read_only: false,
          has_feedback: false,
          min: 0,
          max: 1,
          last_value: 0,
          last_value_changed: '2019-02-12 07:49:07.556 +00:00',
          device_id: '7f85c2f8-86cc-4600-84db-6c074dadb4e8',
          created_at: '2019-02-12 07:49:07.556 +00:00',
          updated_at: '2019-02-12 07:49:07.556 +00:00',
        },
        {
          id: 'ce9dc798-b09f-4e51-8c16-311cdebf97cd',
          name: 'Test device feature 2',
          selector: 'test-device-feature-2',
          external_id: 'hue:brightness:1',
          category: 'light',
          type: 'brightness',
          read_only: false,
          has_feedback: false,
          min: 0,
          max: 100,
          last_value: 20,
          last_value_changed: '2019-02-12 07:49:07.556 +00:00',
          device_id: '7f85c2f8-86cc-4600-84db-6c074dadb4e8',
          created_at: '2019-02-12 07:49:07.556 +00:00',
          updated_at: '2019-02-12 07:49:07.556 +00:00',
        },
        {
          id: '3e1e3c30-18c6-4311-8ac3-7ebd2cea10d2',
          name: 'Test device battery',
          selector: 'test-device-feature-battery',
          external_id: 'hue:battery:1',
          category: 'battery',
          type: 'integer',
          read_only: true,
          has_feedback: false,
          min: 0,
          max: 100,
          last_value: 20,
          last_value_changed: '2019-02-12 07:49:07.556 +00:00',
          device_id: '7f85c2f8-86cc-4600-84db-6c074dadb4e8',
          created_at: '2019-02-12 07:49:07.556 +00:00',
          updated_at: '2019-02-12 07:49:07.556 +00:00',
        },
        {
          id: 'bb1af3b9-f87d-4d9c-b5be-958cd9d28900',
          name: 'Test temperature sensor celsius',
          selector: 'test-temperature-sensor',
          external_id: 'temperature-sensor:1',
          category: 'temperature-sensor',
          type: 'decimal',
          unit: 'celsius',
          read_only: false,
          has_feedback: false,
          min: 0,
          max: 100,
          last_value: 20,
          last_value_changed: new Date().toISOString(),
          device_id: '7f85c2f8-86cc-4600-84db-6c074dadb4e8',
          created_at: '2019-02-12 07:49:07.556 +00:00',
          updated_at: '2019-02-12 07:49:07.556 +00:00',
        },
        {
          id: 'f07c5b27-9301-4482-a059-9f91329d30e7',
          name: 'Test temperature sensor fahrenheit',
          selector: 'test-temperature-sensor-2',
          external_id: 'temperature-sensor:2',
          category: 'temperature-sensor',
          type: 'average',
          unit: 'fahrenheit',
          read_only: false,
          has_feedback: false,
          min: 0,
          max: 100,
          last_value: 100,
          last_value_changed: new Date().toISOString(),
          device_id: '7f85c2f8-86cc-4600-84db-6c074dadb4e8',
          created_at: '2019-02-12 07:49:07.556 +00:00',
          updated_at: '2019-02-12 07:49:07.556 +00:00',
        },
        {
          id: '3b5b4870-145d-4584-bf0e-d97fdcf908b5',
          name: 'Test humidity sensor',
          selector: 'test-humidity-sensor',
          external_id: 'humidity-sensor:1',
          category: 'humidity-sensor',
          type: 'humidity',
          unit: 'percent',
          read_only: false,
          has_feedback: false,
          min: 0,
          max: 100,
          last_value: 56.2,
          last_value_changed: new Date().toISOString(),
          device_id: '7f85c2f8-86cc-4600-84db-6c074dadb4e8',
          created_at: '2019-02-12 07:49:07.556 +00:00',
          updated_at: '2019-02-12 07:49:07.556 +00:00',
        },
        {
          id: '565d05fc-1736-4b76-99ca-581232901d96',
          name: 'Test camera image',
          selector: 'test-camera-image',
          external_id: 'camera:image',
          category: 'camera',
          type: 'image',
          unit: null,
          read_only: false,
          has_feedback: false,
          min: 0,
          max: 0,
          last_value: null,
          last_value_string: RANDOM_IMAGE,
          last_value_changed: new Date().toISOString(),
          device_id: 'fbedb47f-4d25-4381-8923-2633b23192a0',
          created_at: '2019-02-12 07:49:07.556 +00:00',
          updated_at: '2019-02-12 07:49:07.556 +00:00',
        },
      ],
      {},
    ),

  down: async (queryInterface, Sequelize) => queryInterface.bulkDelete('t_device_feature', null, {}),
};
